{extend name="./tpl/default/mobile/public/layout.html" /}
{block name="header"}
<link rel="stylesheet" href="/public/home/mobile/css/guanjian/shouhuodizhi.css">
<link rel="stylesheet" href="/public/plugins/dropload/dropload.css">
<link rel="stylesheet" href="/public/plugins/webuploader/webuploader.css">
<style>

</style>
{/block}
{block name="head"}
<div class="am-g" style=" overflow: hidden;white-space: nowrap;text-overflow: ellipsis;margin-top: 10px;">
    <div class="am-u-sm-10">
        <span class="icon iconfont icon-xiangzuojiantou" onclick="history.back(-1)"></span>
    </div>
    <div class="am-u-sm-2">
        <span class="icon iconfont icon-sousuo"></span>
        <span class="icon iconfont icon-gouwuche"></span>
    </div>
</div>
<hr style="border:1px solid #e0e0e0;">
{/block}
{block name="body"}
<div class="am-g" style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
    <div class="am-tabs-bd">
        <div class="am-tab-panel am-fade am-in am-active" id="tab1">
            <div class="am-u-sm-6" style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
                订单号：{$orderInfo.order_sn}
            </div>
            <div class="am-u-sm-6">
                <span style="color: red;">
                    {if condition="$orderInfo.order_status==-1"} 已取消
                    {elseif condition="$orderInfo.pay_status==0"/}未付款
                    {elseif condition="$orderInfo.shipping_status==0"/}未发货
                    {elseif condition="$orderInfo.order_status==2&&$orderInfo.geval_status==0"/}等待评价
                    {elseif condition="$orderInfo.order_status==2&&$orderInfo.geval_status==1"/}已完成
                    {elseif condition="$orderInfo.shipping_status==1"/}等待收货
                    {else /} 已完成
                    {/if}
                </span>
            </div>
            {volist name="orderInfo.item_list" id="vo"}
            <div class="am-u-sm-4">
                <img src="{$vo.goods_thumb}" style="width:100px;height:120px;" alt="">
            </div>
            <div class="am-u-sm-4" style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
                <div class="am-u-sm-12">
                    <p>{$vo.goods_name}</p>
                </div>
            </div>
            <div class="am-u-sm-4">
                <div class="am-u-sm-12">
                    <p>￥{$vo.pay_price}元</p>
                </div>
                <div class="am-u-sm-12">
                    <p>x{$vo.goods_num}{$vo.goods_unit}</p>
                </div>
            </div>
            {/volist}

        </div>

    </div>
    {if condition="$orderInfo.order_status==-1"} 已取消
    {elseif condition="$orderInfo.pay_status==0"/}<a href="{:url('/home/Cart/payOrder',['order_sn'=>$orderInfo['order_sn']])}">去付款</a>
    {elseif condition="$orderInfo.shipping_status==0"/}未发货

    {elseif condition="$orderInfo.order_status==2&&$orderInfo.geval_status==0"/}
    <form action="" class="am-form" id="geval">
        <input type="hidden" name="order_id" value="{$orderInfo.order_id}">
        <div class="am-form-group">
            <label>评价内容</label>
            <textarea name="geval_content" id="" cols="30" rows="10"></textarea>
        </div>
        <div class="am-form-group">
            <label>物流</label>
            <input type="number" class="" name="shipping_scores" value="5">
        </div>
        <div class="am-form-group">
            <label>商品</label>
            <input type="number" class="" name="server_scores" value="5">
        </div>
        <div class="am-form-group">
            <label>服务</label>
            <input type="number" class="" name="geval_scores" value="5">
        </div>
        <div class="am-form-group">
            <label for="doc-select-1">是否匿名</label>
            <select id="doc-select-1" name="is_anonymous">
                <option value="0">否</option>
                <option value="1">是</option>
            </select>
            <span class="am-form-caret"></span>
        </div>

        <button type="button" id="upimg"> 上传图片</button>
        <div id="img-list" class="am-g">
        </div>
        <button type="button" class="am-btn am-btn-default" onclick="geval()">发表评论</button>
    </form>
    <div style="height: 43px"></div>
    {elseif condition="$orderInfo.order_status==2&&$orderInfo.geval_status==1"/}
    已完成
    {elseif condition="$orderInfo.shipping_status==1"/}
    <a
            onclick="doAction(this)"
            data-url="{:url('/home/Order/orderFinnshed',['order_id'=>$orderInfo['order_id']])}"
    >确认收货</a>
    {/if}
</div>
<div data-am-widget="list_news" class="am-list-news am-list-news-default" >
    <!--列表标题-->
    <div class="am-list-news-hd am-cf">
        <!--带更多链接-->
            <h2>订单记录</h2>
    </div>

    <div class="am-list-news-bd">
        <ul class="am-list">
            {volist name="orderInfo['log_list']" id="vo"}
            <li class="am-g am-list-item-dated">
                <a class="am-list-item-hd ">{$vo.log_msg}</a>

                <span class="am-list-date">{$vo.log_time|date='Y-m-d',###}</span>


            </li>
            {/volist}


        </ul>
    </div>

</div>

{/block}
{block name="script"}
<script src="/public/common.js"></script>
<script src="/public/plugins/webuploader/webuploader.min.js"></script>
<script>
    uploadOnePic('upimg','member',function (data) {
        var html=$('<div class="am-u-sm-3 am-u-end image"></div>')
            .append('<img style="max-width: 100%"' +
                '  src="'+data['url']+'"><input type="hidden" name="geval_image[]" value="'+data['url']+'">' +
                ' <button type="button" onclick="$(this).parents(\'.image\').remove()">删除</button>');
        $('#img-list').append(html);
    });
    function doAction(obj){
        var url=$(obj).data('url');
        layer.open({
            content: '确认收货吗？'
            ,btn: ['确认', '不要']
            ,yes: function(index){
                $.post(url,[],function (data) {
                    layer.open({
                        content: data.msg
                        ,skin: 'msg'
                        ,time: 2 //2秒后自动关闭
                        ,end:function () {
                            rePage()
                        }
                    });
                })
            }
        });
    }
    function geval() {
        var data=$('#geval').serialize();
        $.post('{:url("/home/Order/orderGeval")}',data,function (data) {
            layer.open({
                content: data.msg
                ,skin: 'msg'
                ,time: 2 //2秒后自动关闭
                ,end:function () {
                    rePage();
                }
            });
        })
    }
</script>
{/block}
